<template>
	<view class="mons">
		<view class="top">
			<!-- <view @click="back" class="back">
				<image src="../../static/img/2/2-16.png" mode="widthFix"></image>
			</view> -->
			<navigator url="/pages/user/shareAir">
				<image class="bac" src="../../static/img/3/3-88.png" mode="widthFix"></image>
			</navigator>

		</view>
		<view class="quer">
			<!-- <navigator url="/pages/user/shareL" class="quer-l"> -->
			<view class="quer-l">
				<view>
					{{my.num}}人
				</view>
				成功邀请

			</view>
			<!-- <navigator url="/pages/user/vipLeves" class="quer-l"> -->
			<view class="quer-l">
				<view>
					{{my.score}}积分
				</view>
				累计奖励

			</view>
		</view>
		<view class="titles">
			分享记录
		</view>
		<view class="list">
			<view class="li" v-for="p in person" :key="p.mid">
				<view class="imgbox">
					<!-- <image src="../../static/img/3/3-89.png" mode="widthFix" class="bcc"></image> -->
					<image :src="p.portrait" class="bann" mode="widthFix"></image>
				</view>

				<view class="lef">
					{{p.username}}
					<text>{{p.phone}}</text>
				</view>
				<view class="rig">
					注册时间:{{p.register_time}}
				</view>
				<view class="both"></view>
			</view>


		</view>
	</view>
</template>

<script>
	export default {
		name: "",
		components: {

		},
		data() {
			return {
				meng: false,
				my: {
					num: 0,
					score: 0

				},
				ranking: [],
				list: [],
				person: [],
				intagal: 0,
				pageIndex:1

			}
		},
		onLoad() {
			this.getInt()
			this.getData()
			this.getScore()
		},
		onReachBottom() {
			this.getData()
		},
		methods: {
			back() {
				uni.navigateBack({
					delta: 1
				})
			},
			getInt(){
				let data = {
					"conditions": [{
						"name": "recommender",
						"value1": this.$SysCache.get('userInfo').id || this.$SysCache.get('userInfo').mid,
						"type": "string",
						"op": "eq"
					}],
					"pager": {
						"pageIndex": 1,
						"pageSize": 10000,
						"totalPage": 0,
						"totalCount": 0
					},
					"fields": [{
						"name": "mid"
					}]
				
				}
				this.$Request.post4(
					this.$api.httpApi.user.querys, data
				).then(res => {
					console.log(res)
					this.my.num = res.data.length
					
				
				});
			},
			getData() {
				let data = {
					"conditions": [{
						"name": "recommender",
						"value1": this.$SysCache.get('userInfo').id || this.$SysCache.get('userInfo').mid,
						"type": "string",
						"op": "eq"
					}],
					"pager": {
						"pageIndex": this.pageIndex,
						"pageSize": 20,
						"totalPage": 0,
						"totalCount": 0
					},
					"fields": [{
						"name": "mid"
					}, {
						"name": "username"
					}, {
						"name": "portrait"
					}, {
						"name": "phone"
					}, {
						"name": "register_time"
					}]

				}
				this.$Request.post4(
					this.$api.httpApi.user.querys, data
				).then(res => {
					console.log(res)
					this.person = this.person.concat(res.data)
					this.pageIndex++
					if(res.data.length == 0){
						uni.showToast({
							title:"没有更多了！",
							icon:"none"
						})
					}

				});

				

			},
			getScore(){
				let score = {
					"conditions": [
						
						{
							"name": "mid",
							"value1": this.$SysCache.get('userInfo').id || this.$SysCache.get('userInfo').mid,
							"type": "string",
							"op": "eq"
						},{
							"name": "action_type",
							"value1": 12,
							"type": "string",
							"op": "eq"
						}
						
					],
					"pager": {
						"pageIndex": 1,
						"pageSize": 10000,
						"totalPage": null,
						"totalCount": null
					},
					"orders": [{
						"name": "calculate_date",
						"entity": "PointsDetail",
						"order": "desc"
					}],
					"fields": [{
							"name": "mid"
						},{
							"name": "chang_points"
						}
						
					]
				}
				this.$Request.post4(
					this.$api.httpApi.user.pointsquery, score
				).then(res => {
					console.log(res)
					// this.intagal = res.data
					if(res.data.length>0){
						res.data.forEach(item=>{
							this.my.score+=item.chang_points
						})
					}
				
				});
				
			}
		}

	}
</script>

<style>
	.titles {
		height: 90rpx;
		line-height: 90rpx;
		font-size: 28rpx;
		background: #fff;
		padding-left: 25rpx;
		margin-bottom: 2rpx;
	}

	page .uni-page-head-transparent .uni-page-head-btn {
		background: none !important;
	}

	.meng {
		background: rgba(0, 0, 0, 0.7);
		position: absolute;
		z-index: 15;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
	}

	.both {
		display: block;
		clear: both;
	}

	.quer {
		background: #fff;
		padding-bottom: 45rpx;
		padding-top: 45rpx;
		display: flex;
		margin-bottom: 10rpx;
	}

	.quer .quer-l {
		flex: 1;
		border-right: 1px solid #E4E4E4;
		text-align: center;
		font-size: 22rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: rgba(124, 124, 124, 1);
	}

	.quer .quer-l:nth-child(2) {
		border-right: 0;
	}

	.quer .quer-l view {
		font-size: 30rpx;
		color: #F0406F;
	}

	.list .li {
		margin-bottom: 1px;
		background: #fff;
		padding-left: 20rpx;
		padding-right: 20rpx;
		padding-bottom: 30rpx;
		padding-top: 30rpx;
		font-size: 26rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: rgba(102, 102, 102, 1);
	}

	.list .li .lef {
		float: left;
		width: 40%;
		margin-top: 10rpx;
		margin-left: 20rpx;
	}

	.list .li .rig {
		font-size: 20upx;
		display: inline-block;
		float: right;
		color: #F0406F;
		margin-top: 25rpx;
	}

	.list .li text {
		display: block;
		font-size: 18rpx;
		color: #9D9D9D;
	}

	.list .li .rig .buton {
		width: 102rpx;
		height: 40rpx;
		background: rgba(240, 64, 111, 1);
		border-radius: 20rpx;
		font-size: 20rpx;
		font-family: Microsoft YaHei;
		font-weight: 400;
		color: rgba(255, 255, 255, 1);
		text-align: center;
		line-height: 40rpx;
		margin-top: 8rpx;
	}

	.list .li .rig .bun {
		background: rgba(201, 167, 110, 1);
	}

	.list .li .rig image {
		display: inline-block;
		width: 16rpx;
		vertical-align: middle;
		margin-left: 19rpx;
	}

	.list .li .rig text {
		display: inline-block;
		vertical-align: middle;
	}

	.list .li .bann {
		display: inline-block;
		width: 67rpx;
		height: 67rpx;
		margin: auto;
		border-radius: 50%;
		vertical-align: middle;
		/* 	margin-top: 5rpx;
	margin-right: 23rpx; */
	}

	.list .li .imgbox {
		width: 78rpx;
		display: block;
		float: left;
		text-align: center;
		position: relative;
		height: 84rpx;
		line-height: 95rpx;
	}

	.list .li .imgbox .bcc {
		position: absolute;
		z-index: 5;
		width: 100%;
		margin: auto;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
	}

	uni-page-body {
		height: 100%;
	}

	.mons {
		min-height: 100%;
		background: #EEEEEE;
	}

	.top {
		position: relative;
	}

	.top .back {
		position: absolute;
		z-index: 10;
		width: 60rpx;
		height: 60rpx;
		left: 0;
		top: 0;
		text-align: center;
		line-height: 60rpx;
	}

	.top .back image {
		display: inline-block;
		vertical-align: middle;
		width: 19rpx;
	}

	.top .mo {
		position: relative;
		z-index: 10;
	}

	.top .bac {
		display: block;
		width: 100%;
		position: relative;
		z-index: 5;
	}

	.uni-page-head-transparent .uni-page-head-btn {
		background: none !important;
	}
</style>
